# -*- coding: utf-8 -*-
#
#    pyqtsozluk, qtsozluk and pysozluk mix dictionary application
#    Copyright (C) 2007  pyqtsozluk authors
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import os
from distutils.core import setup

#compile translations
locales = []
translations = ["tr"]
for i in translations:
    try:
        os.mkdir("po/%s" %  i)
    except:
        pass
    os.system("msgfmt po/%s.po -o po/%s/pyqtsozluk.mo" % (i, i))
    locales.append(('share/locale/%s/LC_MESSAGES' % i, ['po/%s/pyqtsozluk.mo' % i]))

#extract database
if not os.path.exists("data/pyqtsozluk.db"):
    os.system("bzip2 -d -k data/pyqtsozluk.db.bz2")

datas = [('share/pyqtsozluk',                  ['data/pyqtsozluk.db']),
         ('share/pyqtsozluk/images/',          ['data/images/about.png','data/images/configure.png','data/images/forward.png', 'data/images/quit.png','data/images/start.png']),
         ('share/pyqtsozluk', ['data/images/pyqtsozluktray.png']),
         ('share/applications',                ['data/pyqtsozluk.desktop']),
         ('share/icons/hicolor/scalable/apps', ['data/pyqtsozluk.svg']),
         ('share/pyqtsozluk/flags',            ['data/en.gif', 'data/tr.gif']),
         ('share/pyqtsozluk',                  ['pyqtsozluk/mainWindow.ui']),
         ]
datas.extend(locales)

setup(name = "pyqtsozluk",
      version = "0.3_alfa1",
      description = "Online/offline Turkish<->English dictionary.",
      license = "GNU General Public License, Version 3",
      author = "pyqtsozluk developers",
      author_email = "pyqtsozluk@googlegroups.com",
      url = "http://code.google.com/p/pyqtsozluk",
      packages = ["pyqtsozluk"],
      data_files = datas,
      scripts = ['scripts/pyqtsozluk', 'scripts/pyqtsozlukcli']
      )
